//
//  CustomKbCollectionViewCell.swift
//  ZNZXSuperMarket
//
//  Created by 四川中农 on 2018/8/7.
//  Copyright © 2018年 四川中农. All rights reserved.
//

import UIKit

class CustomKbCollectionViewCell: UICollectionViewCell {
    
    var titleButton:UIButton!
    
    var backClosure:BackStringValue!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.titleButton = UIButton.init(type: .custom)
        self.titleButton.frame = self.bounds
        self.titleButton.titleLabel?.font = UIFont.systemFont(ofSize: 23)
        self.titleButton.setTitleColor(UIColor.init(hexColor: "#333333"), for: .normal)
        self.titleButton.setBackgroundImage(UIImage.imageWithColor(UIColor.init(hexColor: "#f7f7f7")), for: .normal)
        self.titleButton.setCornerRadio(radio: 5, isMask: true)
//        self.titleButton.setShadow(color: "000000", offset: CGSize.init(width: 0, height: 1), radius: 1, opacity: 0.2)
        self.titleButton.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
        self.addSubview(self.titleButton)
        self.setShadow(color: "000000", offset: CGSize.init(width: 0, height: 1), radius: 1, opacity: 0.2)
    }
    
    @objc func btnClick(sender:UIButton){
        let value = sender.titleLabel?.text!
        if self.backClosure != nil {
            self.backClosure(value!)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
}
